﻿using System.Threading.Tasks;
using CommunityToolkit.Mvvm.Input;

namespace AvaloniaApplication1.ViewModels;

public partial class LoginViewModel : ViewModelBase
{
    /// <summary>
    /// The email of the user
    /// </summary>
    public string? Email { get; set; }

    /// <summary>
    /// register
    /// </summary>
    [RelayCommand]
    private void OnRegister()
    {
        ViewModelLocator.Instance.ApplicationViewModel.GoToPage(ApplicationPage.Register);
    }
    
    /// <summary>
    /// login in
    /// </summary>
    [RelayCommand]
    private Task OnLoginAsync()
    {
        return RunCommandAsync(() => IsBusy, async () =>
        {
            await Task.Delay(1000);
            ViewModelLocator.Instance.ApplicationViewModel.GoToPage(ApplicationPage.Chat);
        });
    }
}
